@extends('layouts.app')
@include('shop.sidebar')
@section('content')
    <div class="content">
        <div class="row custom-invoice">
            <span class="btn btn-success" id="showHideForm">添加类别</span>
            <br />
            <br />
            <table class="table table-striped table-hover">
                <thead>
                <tr>
                    <th>id</th>
                    <th>类名</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach($data as $item)
                    <tr>
                        <td>{{ $item->id }}</td>
                        <td>{{ $item->name }}</td>
                        <td>
                            <a class="btn btn-primary btn-xs delete-confirm" data-href="{{ route('admin.shop.category.delete', ['id' => $item->id]) }}"><i class="fa fa-trash-o"></i> 删除</a>
                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>
        </div>

        <div class="modal fade loading custom-hide" id="hideForm" tabindex="-1" role="dialog" aria-labelledby="hideFormLibel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
            <div class="modal-dialog">
                <div class="content invoice" style="text-align: left">
                    <form class='form' id = 'scheduleForm' action="{{ route("admin.shop.category.store") }}" method="post">
                        <input type="hidden" name="_token" value="{{ csrf_token() }}" />
                        <div class="form-group">
                            <label>名字：</label>
                            <input class="form-control" name="name" type="text" style="width: 100%;"/>
                        </div>
                        <div class="form-group">
                            <button type="submit" class="btn btn-success form-control">提交</button>
                            <br />
                            <br />
                            <button type="button" class="btn" id="closeHideForm">关闭</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
@endsection
@push('scripts')
    <script>
        $('#showHideForm').on('click', function () {
            $("#hideForm").modal('show');
        });

        $('#closeHideForm').on('click', function () {
            $("#hideForm").modal('hide');
        });
    </script>
@endpush
